<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title th:text="${agent.copyRight ?: '宇墨AI智能助手'}"></title>
    <link rel="icon" href="https://witmore.oss-cn-hangzhou.aliyuncs.com/agent/favicon.ico">
    <link href="https://witmore.oss-cn-hangzhou.aliyuncs.com/cdn/npm/font-awesome/6.4.0/all.min.css" rel="stylesheet">
    <link rel="stylesheet"
          href="https://witmore.oss-cn-hangzhou.aliyuncs.com/cdn/npm/element-ui/2.15.14/lib/theme-chalk/index.css">
    <script src="https://witmore.oss-cn-hangzhou.aliyuncs.com/cdn/npm/tailwindcss/3.4.16/tailwindcss.min.js"></script>
    <link rel="stylesheet" href="/css/common.css">
    <link th:href="@{/css/index.css}" rel="stylesheet">
    <script src="https://witmore.oss-cn-hangzhou.aliyuncs.com/cdn/npm/vue/2.6.14/vue.min.js"></script>
    <script src="https://witmore.oss-cn-hangzhou.aliyuncs.com/cdn/npm/element-ui/2.15.14/index.js"></script>
    <script src="https://witmore.oss-cn-hangzhou.aliyuncs.com/cdn/npm/marked/15.0.12/marked.min.js"></script>
    <script src="https://witmore.oss-cn-hangzhou.aliyuncs.com/cdn/npm/purify/3.2.6/purify.min.js"></script>
    <script th:inline="javascript">
        var agent = /*[[${agent}]]*/ {};
        // console.log('agent->', agent)
        var publishList = /*[[${publishList}]]*/[];
        // console.log('publishList->', publishList)
        var chat_source = 'web';
    </script>
    <script src="https://witmore.oss-cn-hangzhou.aliyuncs.com/cdn/npm/Pxmu.js/1.1.0/pxmu.min.js"></script>
    <script src="https://witmore.oss-cn-hangzhou.aliyuncs.com/cdn/npm/axios/0.19.0/axios.min.js"></script>
    <script src="https://witmore.oss-cn-hangzhou.aliyuncs.com/cdn/npm/dayjs/1.8.15/dayjs.min.js"></script>
    <script src="/js/vconsole.js"></script>
    <script th:src="@{/js/common.js}"></script>
    <script th:src="@{/js/request.js}"></script>
    <script th:src="@{/js/fetch_es5.js}"></script>
    <script th:src="@{/js/api_robot.js}"></script>
    <script>
        // 显示退出登录确认对话框
        function showLogoutConfirm() {
            if (confirm('确定要退出登录吗？')) {
                performLogout();
            }
        }
        
        // 执行退出登录
        function performLogout() {
            // 直接跳转到退出登录页面，让服务器处理
            window.location.href = '/logout';
        }


    </script>
</head>

<body>
<div class="chat-container">
    <div class="chat-header flex items-center justify-center relative bg-gradient-to-r from-[#0066ff] to-[#3385ff]">
        <!-- 退出登录按钮 - 左上角 -->
        <span th:if="${agent.loginFlag == 1}" class="logout-btn absolute z-1 left-4 cursor-pointer p-1.5 w-8 h-8 inline-block rounded-full box-border bg-[#fff] hover:bg-[#f0f0f0]" onclick="showLogoutConfirm()" title="退出登录">
            <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
                <path fill-rule="evenodd" d="M3 3a1 1 0 00-1 1v12a1 1 0 102 0V4a1 1 0 00-1-1zm10.293 9.293a1 1 0 001.414 1.414l3-3a1 1 0 000-1.414l-3-3a1 1 0 10-1.414 1.414L14.586 9H7a1 1 0 100 2h7.586l-1.293 1.293z" clip-rule="evenodd"></path>
            </svg>
        </span>
        
        <span th:text="${agentShowTitle ?: agent.agentName}"></span>
        
        <!-- 清除聊天记录按钮 - 右上角 -->
        <span class="absolute z-1 right-6 cursor-pointer p-1.5 w-8 h-8 inline-block rounded-full box-border bg-[#fff]" onclick="clearChatHistoryOne()">
            <img src="" alt="" srcset="">
        </span>
    </div>
    <th:block th:replace="~{fragments/chat::chat}"></th:block>
</div>
</body>

</html>